﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimationAutoDestroyer : MonoBehaviour
{

    public float delay = 0f;
    
    void Start()
    {
        Animator animator = GetComponent<Animator>();
        if (animator)
        {
            Destroy (gameObject, animator.GetCurrentAnimatorStateInfo(0).length + delay); 
        }
        else
        {
            Destroy(gameObject);
        }
    }
}
